package com.sibbay.vta;

import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Toast;

public class CommonActivity extends Activity {

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
	    getMenuInflater().inflate(R.menu.common, menu);
	    return super.onCreateOptionsMenu(menu);
	}
	
	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
	    if (item.getItemId() == R.id.menu_send_feedback) {
	    	final Intent intent = new Intent(Intent.ACTION_SEND);
	    	intent.setType("message/rfc822");//"text/plain");
	    	intent.putExtra(Intent.EXTRA_EMAIL, new String[]{"vta2go@sibbay.com"});
	    	intent.putExtra(Intent.EXTRA_SUBJECT, "VTA 2 GO");
	    	intent.putExtra(Intent.EXTRA_TEXT, "I have an idea about \"" + getString(R.string.app_name) + "\" application ...");
	    	try {
//	    		startActivity(intent);
	    	    startActivity(Intent.createChooser(intent, "Send email about \"" + getString(R.string.app_name) + "\" ..."));
	    	} catch (android.content.ActivityNotFoundException ex) {
	    	    Toast.makeText(this, "There are no email clients installed.", Toast.LENGTH_LONG).show();
	    	}
	    	return true;
	    } else {
	        return super.onOptionsItemSelected(item);
	    }
	}
}
